package com.example.study.ui.viewmodel


import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.lifecycle.ViewModel



/**
 *  created by 20300
 *   on 2022/4/12
 *   describe:
 */

class ToolShowLIstViewModel : ViewModel() {
    var viewStates by mutableStateOf(ToolShowViewState())
    private set
    
    init{
        dispatch(ToolAction.GetToolListData)
    }

    private fun dispatch(action: ToolAction) {
        when(action){
            is ToolAction.GetToolListData -> getData()
        }
    }

    private fun getData() {
        viewStates = viewStates.copy(
            "工具列表",
            mutableListOf(
                ToolItemBean("工具",""),
            )
        )
    }
}



data class ToolShowViewState(
    val title:String = "",
    val toolList:MutableList<ToolItemBean> = mutableListOf()

)
data class ToolItemBean(
    val toolName:String = "",
    val route:String = "",
)
sealed class ToolAction{
    object GetToolListData:ToolAction()
    //data class SetSearchKey(val key: String) : SearchViewAction()
}